/**
 * 
 */
package cn.edu.bjtu.entity.impl;

import javax.servlet.http.HttpServletRequest;

import cn.edu.bjtu.constant.Constant;
import cn.edu.bjtu.entity.Command;

/**
 * @author alex
 *
 */
public class CommandBuilder {
	
	public static Command build(HttpServletRequest req){
		String type = req.getParameter(Constant.COMMAND_TYPE);
		if(type == null){
			type = (String) req.getAttribute(Constant.COMMAND_TYPE);
		}
		switch(type){
		
		case Constant.COMMAND_TYPE_TFIDF_TRANS:
			return new TFIDFTransCommand();
		case Constant.COMMAND_TYPE_TFIDF:
		case Constant.COMMAND_TYPE_WORD2VEC:
		case Constant.COMMAND_TYPE_WORD2VEC_TRANS:
		case Constant.COMMAND_TYPE_LDA:
		case Constant.COMMAND_TYPE_LDA_TRANS:
		case Constant.COMMAND_TYPE_WORD2VEC_SYNC:
		case Constant.COMMAND_TYPE_LDA_SYNC:
		case Constant.COMMAND_TYPE_REFLECT:
			
		default:return new GeneralCommand();
		}
	
	}	
	
}
